package com.by.charpter03.services;

import android.app.Service;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;
import android.util.Log;

import com.by.charpter03.MApp;
import com.by.charpter03.R;

public class StartService extends Service {
    String TAG = StartService.class.getSimpleName();


    @Override
    public void onCreate() {
        super.onCreate();
        Log.d(TAG, "onCreate");
        Log.d(TAG, Thread.currentThread().getName());

    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.d(TAG, "onStartCommand");

        MApp.APP.getMedia().start();
        return START_STICKY_COMPATIBILITY;
    }

    @Override
    public void onDestroy() {


        Log.d(TAG, "onDestroy");
        MApp.APP.releaseMediaPlayer();
        super.onDestroy();
    }

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}
